package cn.thoughtworks.school.entities;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.hankcs.hanlp.HanLP;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "basicQuizChoices")
@Getter
@Setter
public class BasicQuizChoices {
    @EmbeddedId
    private BasicQuizChoicesComplexPK complexPK;
    private String choice;

    public BasicQuizChoices() {
    }

    public BasicQuizChoices(BasicQuizChoicesComplexPK complexPK, String choice) {
        this.complexPK = complexPK;
        this.choice = choice;
    }

    @JsonProperty("choice_zh_TW")
    public String getChoiceTW() {
        return Objects.isNull(choice) ? "" : HanLP.s2tw(choice);
    }
}
